<template>
	<view class="page">
		<view>
			<view class="all_company">
				<view class="company_box" v-for="(item,index) in typeDetails" :key="index"
					@click="toServiceDetail(item)">
					<image class="img" :src="item.coverImg[0]"></image>
					<view class="company_name">
						<text class="cu" v-if="item.activityFlag == 1">促</text>
						<text class="title">{{item.title}}</text>
					</view>
					<view class="price">
						<text class="pri">￥{{item.price}}</text>
						<text class="zixun">{{item.advisoryNumber}}人咨询</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {

		},
		data() {
			return {
				typeDetails: []
			}
		},
		onLoad(op) {
			this.getTypeDetails(op.type)
		},
		methods: {
			getTypeDetails(typeName) {
				uni.request({
					url: this.$serverUrl + 'ftService/searchByType',
					data: {
						"pageNo": 1,
						"pageSize": 10,
						"type": typeName,
						"browseNumber": null,
						"advisoryNumber": null,
						"serviceCity": "城市2"
					},
					method: 'POST',
					success: (res) => {
						let data = res.data.data
						if (data.length > 0) {
							for (let i = 0; i < data.length; i++) {
								data[i].coverImg = data[i].coverImg.split(',')
							}
							this.typeDetails = data
						}
					}
				})
			},
			//跳转服务详情
			toServiceDetail(item) {
				let that = this
				uni.request({
					url: that.$serverUrl + 'ftService/addServiceBrowseNumber/' + item.id,
					success: (res) => {

					}
				})
				uni.navigateTo({
					url: '/pages/serve/serviceDetail?op=' + encodeURIComponent(JSON.stringify(item))
				})
			},
		}
	};
</script>

<style lang="scss">
	page {}

	.date {
		color: #999999;
		font-size: 24upx;
		margin-top: 40upx;
	}

	.dynamic {
		margin: 20rpx;
		display: flex;
		height: 176upx;
		margin-top: 40upx;
	}

	.dynamic_left {
		width: 176upx;
		height: 176upx;
	}

	.dynamic_right {
		margin-left: 24upx;
		width: 70%;
	}

	.active {
		color: #00B2CA;
		font-weight: bold;
		// border-bottom: 2px solid #00B2CA;
		// padding-bottom: 30upx;
		position: relative;
	}

	.active::after {
		content: " ";
		width: 90upx;
		height: 3px;

		background: #00B2CA;
		position: absolute;
		/* bottom: -0.1rem; */
		bottom: -20upx;
		left: 50%;
		transform: translateX(-50%);
	}

	.head-nav {
		display: flex;
		align-items: center;
		justify-content: space-around;
		height: 106upx;
		border-bottom: 1px solid #DCDFE6;
		color: #666666;
	}

	.all_company {
		margin: 40upx 36upx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.company_box {
		width: 330upx;
		margin: 20upx 0;
	}

	.img {
		width: 330upx;
		height: 330upx;
		border-radius: 10upx;
	}

	.cu {
		width: 50upx;
		height: 50upx;
		background-color: #f87935;
		color: #FFFFFF;
		text-align: center;
		line-height: 50upx;
		border-radius: 5upx;
		margin-right: 15upx;
		padding: 5upx;
	}

	.company_name {
		margin-top: 20upx;
		letter-spacing: 5upx;
	}

	.price {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 40upx;
	}

	.pri {
		color: #e04141;
		font-size: 34upx;
		font-weight: bold;
	}

	.zixun {
		color: #666666;
		font-size: 24upx;
	}

	.title {
		font-size: 34rpx;
	}
</style>
